﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Syncfusion.Windows.Chart;
using System.Windows.Input;
using Syncfusion.Windows.Shared;

namespace WPFChartDemo
{
    public class ColumnChartViewModel
    {
        public ColumnChartViewModel()
        {
            this.CO2ReductionDetails = new ObservableCollection<CO2Reduction>();

            CO2ReductionDetails.Add(new CO2Reduction() { Country = "澳大利亚", Potential = 128.4 });
            CO2ReductionDetails.Add(new CO2Reduction() { Country = "中国", Potential = 26.3 });
            CO2ReductionDetails.Add(new CO2Reduction() { Country = "美国", Potential = 21.2 });
            CO2ReductionDetails.Add(new CO2Reduction() { Country = "韩国", Potential = 18.5 });
            CO2ReductionDetails.Add(new CO2Reduction() { Country = "加拿大", Potential = 17.5 });
            CO2ReductionDetails.Add(new CO2Reduction() { Country = "德国", Potential = 16.1 });
            CO2ReductionDetails.Add(new CO2Reduction() { Country = "日本", Potential = 14.5 });
            CO2ReductionDetails.Add(new CO2Reduction() { Country = "法国", Potential = 14.3 });
            CO2ReductionDetails.Add(new CO2Reduction() { Country = "意大利", Potential = 12.2 });
        }
        public IMainView mainView;
        public ColumnChartViewModel(IMainView chart1Win)
        {
            mainView = chart1Win;
        }

        public ObservableCollection<CO2Reduction> CO2ReductionDetails { get; set; }
        public Array PaletteCollection
        {
            get
            {
                return new ChartColorPalette[] { ChartColorPalette.Nature, 
                                          ChartColorPalette.Metro, 
                                          ChartColorPalette.Default, 
                                          ChartColorPalette.DefaultDark,
                                          ChartColorPalette.MixedFantasy
                                        };
            }
        }


        public BaseEntityApi.CommandBase _ButtonClickCommand;

        public ICommand ButtonClickCommand
        {
            get
            {
                if (_ButtonClickCommand == null)
                {
                    _ButtonClickCommand = new BaseEntityApi.CommandBase(o => this.ButtonClick());
                }
                return _ButtonClickCommand;
            }
        }

        private object ButtonClick()
        {
            if (mainView != null)
            {
                mainView.OkButtonClick();
            }
            return "";
        }
           
    }
}
